package com.jpemartin.jgt;
import java.awt.Rectangle;
import java.util.*;

/** 
 * Combines the movement from several MoveControls.
 * 
 * @author jpmartin
 */
public class MoveCombiner implements MoveControl {

   protected List<MoveControl> _moves;
   
   /** pass as many MoveControl as you want to the ctor */
   public MoveCombiner(MoveControl... moveControls) {
      _moves = new ArrayList<MoveControl>();
      _moves.addAll(Arrays.asList(moveControls));
   }

   /** move the given rectangle using all of the combined MoveControl s */
   public void move(Rectangle moved) {
      int x = 0;
      while (x<_moves.size()) {
         _moves.get(x++).move(moved);
      }
   }
}
